package com.loong.shop.controller.forehead;

import com.loong.common.mvc.BaseForeheadController;
import com.loong.common.rest.Result;
import com.loong.common.validator.group.CommonValidate;
import com.loong.shop.common.forehead.param.GoodsSkuForeheadParam;
import com.loong.shop.handler.GoodsSkuHandler;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Description: 处理前台商品sku请求的Controller
 * @Author: 刘群
 * @Date: 2020/10/27 8:55
 */
@RestController
@RequestMapping("forehead/shop/goodsSku")
public class GoodsSkuForeheadController extends BaseForeheadController {

    @Resource
    private GoodsSkuHandler skuHandler;

    /**
     * 联合查询商品详情等信息
     * @param param 查询参数：商品id、规格组
     * @return 响应的结果
     */
    @PostMapping("joinQuery")
    //TODO 这个接口好像有点问题，好像查不出数据，到时候再看看
    public Result joinQueryGoodsSkuDto(@RequestBody @Validated({CommonValidate.class}) GoodsSkuForeheadParam param){
        return handlerExecutor.execute(() -> skuHandler.joinQueryGoodsSkuDto(param));
    }
}
